package com.homework17;

import java.io.File;
import java.io.FileFilter;

public class demo {
    public static void main(String[] args) {
        File file = new File("D:\\a");
        if(file.isDirectory()){
            getFile(file);
        }else {
            System.out.println("不是一个目录");
        }
    }

    private static void getFile(File file) {
        if(file.exists()&&file.isDirectory()){
            File[] files = file.listFiles(new FileFilter() {
                @Override
                public boolean accept(File pathname) {
                    return pathname.length()/1024<200||pathname.isDirectory();
                }
            });
            for (File file1 : files) {
                if(file1.isFile()){
                    System.out.println(file1.getAbsolutePath());
                }else{
                    getFile(file1);
                }
            }
        }
    }
}
